package com.mida.dms.knw.api;

import com.mida.dms.knw.entity.KnwNoumenonUserSpace;
import com.mida.dms.knw.entity.vo.KnwNoumenonRelationVo;
import com.mida.dms.knw.entity.vo.KnwNoumenonTreeVo;
import com.mida.dms.knw.vo.KnwNoumenonPageVo;
import com.mida.dms.knw.vo.KnwNoumenonVo;
import com.mida.dms.knw.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.mida.tool.common.result.BaseResult.buildListWarn;

/**
 * <h1>本体对外服务接口</h1>
 * <p>
 *
 * </p>
 *
 * @author jian.li on 2021/6/22 9:50
 */
@DependsOn("loadFromDatabasePropertyConfig")
@FeignClient(name = "knwNoumenonApi", url = "dms.knw.feign.url")
//@FeignClient(name = "knwNoumenonApi", url = "${dms.knw.feign.url}")
public interface KnwNoumenonApi {

    /**
     * 新增本体(草稿状态,含规则)
     *
     * @param knwNoumenonVo
     * @return
     */
    @ApiOperation(value = "新增本体", notes = "新增本体")
    @PostMapping(value = "/knwNoumenon/addKnwNoumenon", produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult add(@RequestBody KnwNoumenonVo knwNoumenonVo);

    /**
     * 更新本体(含规则)
     *
     * @param knwNoumenonVo
     * @return
     */
    @ApiOperation(value = "更新本体", notes = "更新本体")
    @PostMapping(value = "/knwNoumenon/updateKnwNoumenon", produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult update(@RequestBody KnwNoumenonVo knwNoumenonVo);

    /**
     * 删除本体(含规则)
     */
    @ApiOperation(value = "删除本体", notes = "删除本体")
    @ApiImplicitParam(name = "soid", value = "本体soid")
    @DeleteMapping(value = "/knwNoumenon/deleteKnwNoumenon",produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult delete(@RequestParam(value = "soid") long soid);

    /**
     * 获取本体
     */
    @ApiOperation(value = "获取本体", notes = "获取本体")
    @ApiImplicitParam(name = "soid", value = "本体soid")
    @GetMapping(value = "/knwNoumenon/getKnwNoumenon",produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<com.mida.dms.knw.entity.vo.KnwNoumenonVo> get(@RequestParam(value = "soid") Long soid);

    /**
     * 分页查询本体
     */
    @ApiOperation(value = "分页查询本体", notes = "分页查询本体")
    @PostMapping(value = "/knwNoumenon/findPage", consumes = {"application/json;charset=UTF-8"},produces = "application/json;charset=UTF-8")
    @ResponseBody
    ListResult<PageResultVo<com.mida.dms.knw.entity.vo.KnwNoumenonVo>> findPage(@RequestBody KnwNoumenonPageVo vo);

    /**
     * 查重
     *
     * @param originalSoid
     * @param newNoumenonType
     * @param newNoumenonSubType
     * @param newNoumenonShowName
     * @return
     */
    @ApiOperation(value = "重复性验证", notes = "重复性验证")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "originalSoid", value = "原本体soid"),
            @ApiImplicitParam(name = "newNoumenonType", value = "新本体分类代码"),
            @ApiImplicitParam(name = "newNoumenonSubType", value = "新本体领域类型"),
            @ApiImplicitParam(name = "newNoumenonShowName", value = "新本体显示名称")
    })
    @GetMapping(value = "/knwNoumenon/checkDataRepeat", produces = {"application/json;charset=UTF-8"},consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult checkDataRepeat(@RequestParam(value = "originalSoid") Long originalSoid, @RequestParam(value = "newNoumenonType") Long newNoumenonType,
                                 @RequestParam(value = "newNoumenonSubType") Long newNoumenonSubType,@RequestParam(value = "newNoumenonShowName") String newNoumenonShowName);

    /**
     * 查询所有本体
     */
    @ApiOperation(value = "查询所有本体", notes = "查询所有本体")
    @GetMapping(value = "/knwNoumenon/findAll", produces = {"application/json;charset=UTF-8"},consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<List<com.mida.dms.knw.entity.vo.KnwNoumenonVo>> findAll(@RequestParam(value = "search") String search);

    /**
     * 获取本体类型树状结构
     *
     * @return
     */
    @ApiOperation(value = "获取本体类型树状结构", notes = "获取本体类型树状结构")
    @GetMapping(value = "/knwNoumenon/getTree",produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<List<KnwNoumenonTreeVo>> getTree();

    /**
     * 查询本体树状结构子树
     *
     * @return
     */
    @ApiOperation(value = "获取本体类型树状结构", notes = "获取本体类型树状结构")
    @GetMapping(value = "/knwNoumenon/getSubTree",produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<List<KnwNoumenonRelationVo>> getSubTree(@RequestParam("noumenonSoid") Long noumenonSoid);

    /**
     * 查询本体树(局部解剖学)根树
     *
     * @param noumenonSoid
     * @return
     */
    @ApiOperation(value = "获取本体树(局部解剖学)根树", notes = "获取本体树(局部解剖学)根树")
    @GetMapping(value = "/knwNoumenon/getLocalAnatomyRootTree",produces = "application/json;charset=UTF-8",consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<List<KnwNoumenonRelationVo>> getLocalAnatomyRootTree(@RequestParam("noumenonSoid") Long noumenonSoid);

    /**
     * 11. 批量插入本体与授权空间
     * @param
     * @return
     */
    @PostMapping(value = "/knwNoumenon/bulkInsertknwNoumenonUserSpace",consumes ={"application/json;charset=UTF-8"} )
    @ResponseBody
    public ActionResult bulkInsertknwNoumenonUserSpace(@RequestBody List<KnwNoumenonUserSpace> KnwNoumenonUserSpaces );

    /**
     * 12. 批量取消本体与授权空间
     * @param
     * @return
     */
    @PostMapping(value = "/knwNoumenon/batchCancelknwNoumenonUserSpace",consumes ={"application/json;charset=UTF-8"} )
    @ResponseBody
    public ActionResult batchCancelknwNoumenonUserSpace(@RequestBody List<KnwNoumenonUserSpace> KnwNoumenonUserSpaces);


    /**
     * 13. 查询本体列表
     * @param
     * @return
     */
    @PostMapping(value = "/knwNoumenon/selectKnwNoumenonVos",consumes ={"application/json;charset=UTF-8"} )
    @ResponseBody
    public ListResult<PageResultVo<com.mida.dms.knw.entity.vo.KnwNoumenonVo>> selectKnwNoumenonVos(@RequestBody KnwNoumenonPageVo vo);


    /**
     * 14. 查询取消本体列表
     * @param
     * @return
     */
    @PostMapping(value = "/knwNoumenon/selectCancelKnwNoumenonVos",consumes ={"application/json;charset=UTF-8"})
    @ResponseBody
    public ListResult<PageResultVo<com.mida.dms.knw.entity.vo.KnwNoumenonVo>> selectCancelKnwNoumenonVos(@RequestBody KnwNoumenonPageVo vo);

    /**
     * 15. 查询本体列表
     * @param
     * @return
     */
    @PostMapping(value = "/knwNoumenon/selectKnwNoumenonVoList",consumes ={"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<List<com.mida.dms.knw.entity.vo.KnwNoumenonVo>> selectKnwNoumenonVoList(@RequestBody KnwNoumenonPageVo vo);
}
